package cg.project.mapper;

import cg.project.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
/**
 *
 * @author BWHB
 * @date 2024/11/19 19:09
 * @param

 */

public interface UserMapper {
    @Select("select * from tbl_user")
    List<User> findAll();

    @Select("select * from tbl_user where email=#{email}")
    User findByEmail(String email);

    @Select("select * from tbl_user where username=#{username}")
    User findByUser(String username);

    @Select("select * from tbl_user where id=#{id}")
    User findByUserId(int id);

    @Delete("delete from tbl_user where id =#{id};")
    void deleteById(int id);

    @Update("update tbl_user set username = #{username}, email = #{email}, pwd = #{pwd} where id =#{id};")
    void updateById(int id,String username,String email,String pwd);
}